home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / LGP250S1.ZIP / src / libgplus.5 / libgplus / vms / vms_fixi.tpu < prev    next >
Text File  |  1992-05-03  |  2KB  |  54 lines

  1.  
  2.    PROCEDURE vms_include_fix (
  3.       oldstring, !
  4.       newstring)  !
  5.       LOCAL range2, count ;
  6.       position (beginning_of (current_buffer)) ;
  7.       count := 0 ;
  8.       LOOP
  9.          range2 := search_quietly (LINE_BEGIN & "#include" & SPAN(" ")
  10.         & newstring, FORWARD, EXACT) ;
  11.      IF (range2 <> 0) THEN
  12.        message("This file has already been fixed.");
  13.        exit;
  14.        endif;
  15.          range2 := search_quietly (LINE_BEGIN & "#include" & SPAN(" ")
  16.         & oldstring, FORWARD, EXACT) ;
  17.          EXITIF range2 = 0 ;
  18.          position (beginning_of (range2)) ;
  19.      copy_text ("#ifdef VMS");
  20.      split_line;
  21.      copy_text ("#include ");
  22.          copy_text (newstring) ;
  23.      split_line;
  24.      copy_text ("#else");
  25.      split_line;
  26.      move_vertical(1);
  27.      copy_text ("#endif");
  28.      split_line;
  29.          count := count + 1 ;
  30.          ENDLOOP ;
  31.       IF (count > 0) THEN
  32.          message (fao('Replaced pattern !UL time!%S', count)) ;
  33.       ENDIF ;
  34.    ENDPROCEDURE ;
  35.     
  36.    old_string := read_line ("old pattern: ") ;
  37.    new_string := read_line ("new string: ") ;
  38.    filename := GET_INFO (COMMAND_LINE, 'file_name') ;
  39.    LOOP
  40.       exp_filename := FILE_SEARCH (filename) ;
  41.       EXITIF exp_filename = "" ;
  42.       mainbuffer := CREATE_BUFFER (exp_filename, exp_filename) ;
  43.       position (mainbuffer) ;
  44.       vms_include_fix ("<Regex.h>","<rregex.h>");
  45.       vms_include_fix ("<String.h>","<sstring.h>");
  46.       vms_include_fix ("<Complex.h>","<ccomplex.h>");
  47.       IF get_info (mainbuffer, "modified") THEN
  48.          write_file (mainbuffer)
  49.       ELSE
  50.          message ('No changes made.') ENDIF ;
  51.       delete (mainbuffer) ;
  52.       ENDLOOP ;
  53.    quit ;
  54.